5.x Upgrade Guide
Breaking changes
There were several significant breaking changes in RJSF version 5 that were necessary in order to support the following new features:
- Schema validation was decoupled from
@rjsf/coreto resolve issue #2693. Additionally, in order to break a circular dependency in the validation refactor, the@rjsf/core/utils.jsfile was split out into its own@rjsf/utilspackage as was suggested in #1655. - The theme for Material UI version 5 (i.e.
@rjsf/mui) was split out of the theme for version 4 (i.e.@rjsf/material-ui) to resolve the following issues: #2762, #2858, #2905, #2945 - As part of the fix for #2526 all the existing templates in the previous version were moved into a new
templatesdictionary, similar to howwidgetsandfieldswork. Thistemplatesdictionary was added to theRegistryand also theFormprops, replacing theArrayFieldTemplate,FieldTemplate,ObjectFieldTemplateandErrorListprops. In addition, several of thefieldsandwidgetsbased components were moved into thetemplatesdictionary as they were more like templates than trueFields orWidgets. Also fixes #2945 - Fixed
anyOfandoneOfgetting incorrect, potentially duplicate ids when combined with array #2197 CheckboxesWidget,RadioWidgetandSelectWidgetin all themes now use indexes intoenumOptions[]rather thanoption.valueto allow for objects inenumOptions- #1494
Node support
Version 5 is dropping official support for Node 12 as it is no longer a maintained version.
Please use Node 18 when making any changes to package.json and package-lock.json files.
All PR and branch builds are running against Node 14, 16 and 18.
React version
RJSF is no longer actively supporting React version < 16.14.x. React 17 is officially supported on all the themes where the underlying theme library also supports React 17.
Unfortunately, there is required work pending to properly support React 18, so use it at your own risk.
New packages
There are four new packages added in RJSF version 5:
@rjsf/utils: All of the utility functions previously imported from@rjsf/core/utilsas well as the Typescript types for RJSF version 5.- The following new utility functions were added:
ariaDescribedByIds(),createSchemaUtils(),descriptionId(),enumOptionsDeselectValue(),enumOptionsIndexForValue(),enumOptionsIsSelected(),enumOptionsSelectValue(),enumOptionsValueForIndex(),errorId(),examplesId(),getClosestMatchingOption(),getFirstMatchingOption(),getInputProps(),helpId(),mergeValidationData(),optionId(),sanitizeDataForNewSchema()andtitleId()
- The following new utility functions were added:
@rjsf/validator-ajv6: The ajv-v6-based validator refactored out of@rjsf/core@4.x, that implements theValidatorTypeinterface defined in@rjsf/utils.@rjsf/validator-ajv8: The ajv-v8-based validator that is an upgrade of the@rjsf/validator-ajv6, that implements theValidatorTypeinterface defined in@rjsf/utils. See the ajv 6 to 8 migration guide for more information.@rjsf/mui: Previously@rjsf/material-ui/v5, now provided as its own theme.
id BREAKING CHANGES
In many of the themes the ids for the Title, Description and Examples blocks were update to all have a consistent value of xxx__title, xxx__description and xxx__examples, respectively, where xxx is the id of the field.
In addition, some of the ids for various input values were updated to be consistent across themes or to fix small bugs.
For instance, the values for radio buttons in the RadioWidget and checkboxes in the CheckboxesWidget are of the form xxx-${option.value}, where xxx is the id of the field.